package org.ax.service.process.imple;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.ax.mapper.process.ProcessMapper;
import org.ax.mapper.process.TechnologyRequirementMapper;
import org.ax.pojo.process.Process;
import org.ax.pojo.process.TechnologyRequirement;
import org.ax.service.plan.ProductService;
import org.ax.service.process.ProcessService;
import org.ax.service.process.TechnologyRequirementService;
import org.ax.service.process.TechnologyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 编程人:赵浩鑫
 * 时间:2021-02-28-21:25
 */
@Service
public class IProcessService extends ServiceImpl<ProcessMapper, Process> implements ProcessService {
    @Autowired
    TechnologyService technologyService;

    @Override
    public Page<Process> searchProcessPage(Page page) {
        QueryWrapper<Process> queryWrapper=new QueryWrapper<Process>();
        queryWrapper.orderByAsc("sequence");
        return getBaseMapper().selectPage(page, queryWrapper);
    }

    @Override
    public boolean addProcess(Process process) {
        return getBaseMapper().insert(process)>0;
    }

    @Override
    public boolean updateProcess(Process process) {
        return getBaseMapper().updateById(process)>0;
    }

    @Override
    public boolean deletesProcess(String[] ids) {
        return getBaseMapper().deleteBatchIds(Arrays.asList(ids))>0;
    }

    @Override
    public Process toProcessId(String processId) {
        return getBaseMapper().selectById(processId);
    }

    @Override
    public List<Process> availableProcess() {
        return getBaseMapper().selectList(null);
    }
}
